using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace MobileStreams
{
    public partial class frmPlayer : Form
    {
        private Stream currStream;

        public frmPlayer(Stream pStream)
        {
            InitializeComponent();
            
            currStream = pStream;
        }

        private void frmPlayer_KeyPress(object sender, KeyPressEventArgs e)
        {
            // Determine if ESC key value is raised.
            if (e.KeyChar == (Char)Keys.Escape)
            {
                // Handle the event to provide functionality. 
                e.Handled = true;

                // Add your event handling code here.
                //MessageBox.Show("Custom back key functionality.");
            }

        }

        private void frmPlayer_Load(object sender, EventArgs e)
        {
            try
            {
                axWindowsMediaPlayer1.URL = currStream.URL;
            }
            catch (Exception ex)
            {
                MessageBox.Show(string.Format("The URL you provided seems to be invalid: {0}", ex.Message));
            }
        }

        private void menuItem1_Click(object sender, EventArgs e)
        {
            if (axWindowsMediaPlayer1.fullScreen)
            {
                axWindowsMediaPlayer1.fullScreen = false;
            }
            else
            {
                axWindowsMediaPlayer1.fullScreen = true;
            }
        }

        private void frmPlayer_Closed(object sender, EventArgs e)
        {
            //axWindowsMediaPlayer1.URL = "";
            axWindowsMediaPlayer1.close();
            axWindowsMediaPlayer1.Dispose();
        }

        private void menuitemBack_Click(object sender, EventArgs e)
        {
            this.Close();
        }

    }
}


